<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//定义登录路由
//访问路由  api/login
Route::post('login','Api\LoginController@login');
//请求验证
//符合restful标准
//url独立域名或能区别的前缀 api
//url最好有版本
//结束用名词不用动词
//内容可以用 rsa非对称加密 http://blog.csdn.net/haibo0668/article/details/81489217
Route::group(['prefix'=>'v1','namespace'=>'Api'],function (){

    Route::get('users',function (){
       return '123456';
       //
    });
    //小程序登录
    Route::post('wxlogin','LoginController@wxlogin');

    //用户授权信息入库
    //文件上传
    Route::post('user/upfile','UserController@upfile');

    Route::get('user/userinfo','UserController@getuserinfo');
    Route::post('user/userinfo','UserController@userinfo');

    //看房通知
    Route::get('notices','NoticeController@index');
    //资讯列表
    Route::get('news','NewsController@index');
    //使用路由参数
    Route::get('news/{article}','NewsController@show');
    //咨询用户访问记录
    Route::post('news/{article}','NewsController@count');
    //房源
    //房源列表
    Route::get('fangs','FangController@fang');
    //es搜索房源列表
    Route::get('esfangs','FangController@esfang');
    //推荐房源
    Route::get('fangs/recommend','FangController@recommend');
    //房源属性
    Route::get('fangs/attr','FangController@attr');
    //房源详情
    Route::get('fangs/{fang}','FangController@detail');
    //房源属性接口
    Route::get('fangattrs','FangAttrController@attr');
    //添加收藏
    Route::post('favs','FavController@add');
    // 查询收藏
    Route::get('favs/show','FavController@show');
});
